import Vue from 'vue'
import Router from 'vue-router'
// import Login from './views/login'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      // 路由懒加载
      component: () => import('@/views/login/index.vue')
    },
    {
      path: '/',
      // name: 'layout',   如果父路由有默认子路由，那它的name就没有意义
      component: () => import('@/views/layout/index.vue'),
      children: [
        {
          path: '', // 空路径未默认子路由功能 有且只能有一个
          name: 'home',
          component: () => import('@/views/home/index.vue')
        },
        {
          path: '/questions',
          name: 'questions',
          component: () => import('@/views/questions/index.vue')
        },
        {
          path: '/video',
          name: 'video',
          component: () => import('@/views/video/index.vue')
        },
        {
          path: '/my',
          name: 'my',
          component: () => import('@/views/my/index.vue')
        }
      ]
    },
    {
      path: '/search',
      name: 'search',
      // 路由懒加载
      component: () => import('@/views/search/index.vue')
    }
  ]
})
